/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controle.controladores;


/**
 *
 * @author Taeko
 */
public class PD extends ControladorAbstrato{

    private proporcional p;
    private derivativo d;
    private double erroanterior = 0.0, dt = 0.1, retorno = 0;
    
    public PD (double Kp, double Kd){
        super(Kp, 0, Kd);
        p = new proporcional(Kp);
        d = new derivativo(Kd);
    }
    
    @Override
    public double valorControle(double entrada, double h) {
        p.setContantes(Kp, Ki, Kd);
        d.setContantes(Kp, Ki, Kd);
        
        return  p.valorControle(entrada, h) + d.valorControle(entrada, h);
//        retorno =  (p.Kp * h) + (d.Kd * (h - erroanterior)/dt);
//        erroanterior = h;
//        return retorno;
    }
    
}
